package com.cyclecoder.thread;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Semaphore;

/**
 * @author by zhanglei
 * @Date 2021/8/10
 */
public class ThreadSemaphoreDemo {
    public static void main(String[] args) {
//        Semaphore semaphore = new Semaphore(3);
//        for(int i = 0; i < 6; i++){
//            new Thread(()->{
//                try {
//                    semaphore.acquire();
//                    System.out.println("取得进程"+ Thread.currentThread().getName());
//                    Thread.sleep(3000);
//                    System.out.println("释放进程"+ Thread.currentThread().getName());
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                }finally {
//                    semaphore.release();
//                }
//            }).start();
//        }
        Hashtable ht = new Hashtable();
        ht.put(null, "hello");
    }
}
